import axios from './request'

/**
 * 创建订单
 * @param {*} data 
 * @returns 
 */
export const CreateTask = (data) => {
    return axios.post(`/task/create`,data)
}

/**
 * 任务、订单列表
 * @param {*} data 
 * @returns 
 */
export const TaskList = (data) => {
    return axios.get('/task/list', {
        params: data
    })
}

/**
 * 任务详情
 * @param {*} data 
 * @returns 
 */
export const Detail = (id) => {
    return axios.get(`/task/view/${id}`)
}

/**
 * 任务消息列表
 * @param {*} data 
 * @returns 
 */

export const TaskMsgList = (data) => {
    return axios.get('/taskMsg/list', {
        params: data
    })
}

/**
 * 任务消息创建
 * @param {*} data 
 * @returns 
 */
export const TaskMsgCreate = (data) => {
    return axios.post('/taskMsg/create', data)
}

/**
 * 任务消息删除
 * @param {*} data 
 * @returns 
 */
export const DelMsg = (id) => {
    return axios.delete(`/taskMsg/delete/${id}`)
}

/**
 * 任务消息修改
 * @param {*} data 
 * @returns 
 */
export const EditMsg = (data) => {
    return axios.put(`/taskMsg/update`, data)
}

/**
 * 任务飞手列表
 * @param {*} data 
 * @returns 
 */
export const TaskPilotList = (data) => {
    return axios.get('/taskPilot/list', {
        params: data
    })
}

/**
 * 任务修改飞手状态
 * @param {*} data 
 * @returns 
 */
 export const TaskPilotEdit = (data) => {
    return axios.put('/taskPilot/update', data)
}

/**
 * 删除任务飞手
 * @param {*} data 
 * @returns 
 */
 export const TaskPilotDel = (id) => {
    return axios.delete(`/taskPilot/delete/${id}`)
}

/**
 * 可调度飞手列表
 * @param {*} data 
 * @returns 
 */
 export const UserPilot = (data) => {
    return axios.get(`/user/pilot`, {
        params: data
    })
}

/**
 * 省市区列表
 * @param {*} data 
 * @returns 
 */
 export const DstrictList = (data) => {
    return axios.get(`/dstrict/list`, {
        params: data
    })
}

/**
 * 任务批量调度飞手
 * @param {*} data 
 * @returns 
 */
 export const DispatchPilot = (id, data) => {
    return axios.post(`/taskPilot/create/${id}`, data)
}

/**
 * 飞手接收任务
 * @param {*} data 
 * @returns 
 */
export const PilotHandle = (data) => {
    return axios.put('/task/pilotHandle',data)
}

/**
 * 调度接受任务
 * @param {*} data 
 * @returns 
 */
export const TaskHandle = (data) => {
    return axios.put('/task/handle',data)
}

/**
 * 调度完成任务
 * @param {*} data 
 * @returns 
 */
 export const ScheduleComplete = (data) => {
    return axios.put('/task/scheduleComplete',data)
}


/**
 * 飞手完成任务
 * @param {*} data 
 * @returns 
 */
export const PilotComplete = (id) => {
    return axios.get(`/task/pilotComplete/${id}`)
}